home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
001
/
pibt3sp4.arc
/
SENDMODE.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1985-09-04
|
4KB
|
93 lines
(*----------------------------------------------------------------------*)
(* Send_Modem_Command --- Send command to modem *)
(*----------------------------------------------------------------------*)
PROCEDURE Send_Modem_Command( Modem_Text : AnyStr );
(*----------------------------------------------------------------------*)
(* *)
(* Procedure: Send_Modem_Command *)
(* *)
(* Purpose: Sends command to modem *)
(* *)
(* Calling Sequence: *)
(* *)
(* Send_Modem_Command( Modem_Text : AnyStr ); *)
(* *)
(* Modem_Text --- text of command to send to modem *)
(* *)
(* Calls: *)
(* *)
(* Async_Send *)
(* Async_Receive *)
(* *)
(* Remarks: *)
(* *)
(* If the string to be sent has not "Wait For" markers, then *)
(* it is sent in its entirety in one call here. If there ARE *)
(* "Wait For" characters, then the flag WaitString_Mode is set *)
(* TRUE, Script_When_Text is set to the character to be found, *)
(* and Script_When_Reply_Text is set to the remainder of the *)
(* function key string. This allows the terminal emulation to *)
(* properly process any received characters while PibTerm is *)
(* waiting for the selected string to appear. *)
(* *)
(*----------------------------------------------------------------------*)
VAR
I: INTEGER;
L: INTEGER;
Ch: CHAR;
MO_Char: CHAR;
Done: BOOLEAN;
BEGIN (* Send_Modem_Command *)
L := LENGTH( Modem_Text );
I := 1;
Done := FALSE;
WHILE( I <= L ) AND ( NOT Done ) DO
BEGIN
MO_Char := Modem_Text[I];
IF MO_Char = FK_CR THEN
Async_Send( CHR( CR ) )
ELSE IF MO_Char = FK_Delay THEN
DELAY( One_Second_Delay )
ELSE IF MO_Char = FK_Wait_For THEN
BEGIN (* Wait For *)
I := I + 1;
IF ( I <= L ) THEN
BEGIN
WaitString_Mode := TRUE;
Script_When_Text := Modem_Text[I];
I := I + 1;
IF ( I <= L ) THEN
Script_When_Reply_Text := COPY( Modem_Text, I, L - I + 1 )
ELSE
Script_When_Reply_Text := '';
Done := TRUE;
END;
END (* Wait For *)
ELSE
BEGIN
Async_Send( Modem_Text[I] );
IF ( Modem_Command_Delay > 0 )
THEN DELAY( Modem_Command_Delay );
END;
I := I + 1;
END;
END (* Send_Modem_Command *);